package com.demo;

/**
 * @author 许路路
 */
public class Test {

    private int invar = 1;

    public static String concat(String str1, String str2) {
        return str1 + str2;
    }

    public int f() {
        return invar;
    }

    public static void main(String[] args) {
        /*Test test = new Test();
        test.f();
        int localInt1 = 1;
        int localInt2 = 2;
        int sum = localInt1 + localInt2;
        System.out.println(sum);
        String str = concat("string ", "concat");
        System.out.println(str);*/
        System.out.println(result());
        System.out.println(result01());
    }

    private static int result() {
        int i = 1;
        int j = 2;
        int k = 1;
        try {
            int n = i / j;
            return k;
        } finally {
            k++;
            System.out.println("..." + k);
        }
    }

    private static int result01() {
        int i = 1;
        int j = 2;
        Person person = new Person();
        person.setAge(1);
        try {
            int n = i / j;
            return person.getAge();
        } finally {
            person.setAge(person.getAge() + 1);
            System.out.println("......." + person.getAge());
        }
    }

    static class Person {
        int age;

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
    }


}
